package top.leix.springdemo.controller;

import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import top.leix.springdemo.Res;
import top.leix.springdemo.pojo.ApplyLabStudent;
import top.leix.springdemo.services.ApplyLabStudentService;

import javax.annotation.Resource;

@Slf4j
@Tag(name = "学生接口")
@CrossOrigin
@RestController
@RequestMapping("/student")
public class StudentController {
    @Resource
    ApplyLabStudentService applyLabStudentService;

    /**
     * 添加申请的表单
     *
     * @param applyLabStudent apply
     * @return 表单
     */
    @PostMapping("/apply")
    public Res addApplication(@RequestBody ApplyLabStudent applyLabStudent) {
        return applyLabStudentService.addApplication(applyLabStudent);
    }

    /**
     * 更新修改
     *
     * @param applyLabStudent
     * @return
     */
    @PostMapping("/update")
    public Res updateApplication(@RequestBody ApplyLabStudent applyLabStudent) {
        return applyLabStudentService.updateApplication(applyLabStudent);
    }
    /**
     * 更新修改,使用完成
     *
     */
    @PostMapping("/updateFinishedStatus")
    public Res updateFinishedStatus(@RequestBody Integer ApplyID) {
        return applyLabStudentService.updateFinishedStatus(ApplyID);
    }

    /**
     * 根据账号，查询当前学生未审核
     */
    @PostMapping("queryPending")
    public Res queryPending(@RequestBody String userAccount) {
        return applyLabStudentService.queryPending(userAccount);
    }
    /**
     * 根据账号，查询当前学生已通过
     */
    @PostMapping("queryOK")
    public Res queryOK(@RequestBody String userAccount) {
        return applyLabStudentService.queryOK(userAccount);
    }
    /**
     * 根据账号，查询当前学生已拒绝
     */
    @PostMapping("queryRejection")
    public Res queryRejection(@RequestBody String userAccount) {
        return applyLabStudentService.queryRejection(userAccount);
    }

    /**
     * 查询当前学生的所有表单
     */
    @PostMapping("queryHistory")
    public Res queryHistory(@RequestBody String userAccount) {
        return applyLabStudentService.queryHistory(userAccount);
    }

}
